package com.scqzy.shengchunqiang.sword2offer.day03;

/**
 * @Description: 剑指 Offer 05. 替换空格
 * @Author 盛春强
 * @Date 2021/8/10 20:41
 */
public class ReplaceSpace {
    public String replaceSpace(String s) {
        StringBuilder res = new StringBuilder();
        for (char c : s.toCharArray()) {
            if (c == ' ') {
                res.append("%20");
            } else {
                res.append(c);
            }
        }
        return res.toString();
    }
}
